{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5d21c407",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "best structure: <sqsgenerator.core._core.StructureDouble object at 0x000002A534AB45F0>\n",
      "best sublattices: [<sqsgenerator.core._core.SqsResultInteractDouble object at 0x000002A542DAF030>]\n",
      "best objective : 0.0\n"
     ]
    }
   ],
   "source": [
    "from sqsgenerator import parse_config, optimize, write\n",
    "from sqsgenerator.core import LogLevel\n",
    "\n",
    "\n",
    "with open(\"CoNiV-1a-Au.json\") as f:\n",
    "    config = parse_config(f.read())\n",
    "\n",
    "pack = optimize(config, level=LogLevel.info)\n",
    "best = pack.best()\n",
    "\n",
    "print(f\"best structure: {best.structure()}\")\n",
    "print(f\"best sublattices: {best.sublattices()}\")\n",
    "print(f\"best objective : {best.objective}\")\n",
    "\n",
    "write(best.structure(), \"sqs-CoNiV-1a.vasp\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "64d99d25",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "best structure: <sqsgenerator.core._core.StructureDouble object at 0x000002A534AD62F0>\n",
      "best sublattices: [<sqsgenerator.core._core.SqsResultInteractDouble object at 0x000002A534A42DB0>]\n",
      "best objective : 1.690909090909091\n"
     ]
    }
   ],
   "source": [
    "\n",
    "with open(\"CoNiV-3c-Cu.json\") as f:\n",
    "    config = parse_config(f.read())\n",
    "\n",
    "pack = optimize(config, level=LogLevel.info)\n",
    "best = pack.best()\n",
    "\n",
    "print(f\"best structure: {best.structure()}\")\n",
    "print(f\"best sublattices: {best.sublattices()}\")\n",
    "print(f\"best objective : {best.objective}\")\n",
    "\n",
    "write(best.structure(), \"sqs-CoNiV-3c.vasp\")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "sofs",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
